#ifndef MY_DEFINE_H
#define MY_DEFINE_H
#include "./tca9548a/tca9548a.h"
#include "./tlv493d/tlv493d.h"
#include <stdint.h>
#define PRINTF_INFO_EN

typedef enum state_ebox
{
    STATE_RUNNING,
    STATE_SETTING,
    STATE_REST,
} state_e;
typedef enum sensor_select_ebox
{
    SENSOR_DS18B20,
    SENSOR_Kcouple_KCouple,
    SENSOR_ADC_PT100,
} sensor_select_t;
typedef enum control_ebox
{
    CONTROL_IDLE,
    CONTROL_HUMIDITY_RUNNING,
    CONTROL_HUMIDITY_IDLE,
    CONTROL_FANS_RUNNING,
    CONTROL_FANS_IDLE,
} control_e;

// 传感器数据结构体
typedef struct {
    float mag_x;    // X轴磁场（mT）
    float mag_y;    // Y轴磁场（mT）
    float mag_z;    // Z轴磁场（mT）
    float temp;     // 温度（℃）
} TLV493D_Data;

typedef struct machine_sbox
{
    state_e                state;
    I2C_HandleTypeDef      dev_i2c;
    TCA9548A_HandleTypeDef tca_i2c;
    TLV493D_dev            sensor1;
    TLV493D_dev            sensor2;
    TLV493D_dev            sensor3;
    TLV493D_Data          sensor1_data;
    TLV493D_Data          sensor2_data;
    TLV493D_Data          sensor3_data;
    
    char                   sensor1_sate;
    char                   sensor2_sate;
    char                   sensor3_sate;

    char oled_1row[50];
    char oled_2row[50];
    char oled_3row[50];
    char oled_4row[50];
    char oled_5row[50];
    char oled_6row[50];
    char oled_7row[50];
    char oled_8row[50];

} machine_t;

extern machine_t machine;
extern void      safe_printf(const char* fmt, ...);

#endif
